import { Field, Int, ObjectType } from '@nestjs/graphql';

@ObjectType() // 在类上加上这个装饰器
export class Cat {
  constructor(id: number, name: string, age: number, breed: string) {
    this._id = id;
    this._name = name;
    this._age = age;
    this._breed = breed;
  }
  @Field()
  private _id: number;
  @Field({ nullable: false })
  private _name: string;
  @Field({ nullable: true })
  private _age: number;
  @Field({ nullable: true })
  private _breed: string;

  getId(): number {
    return this._id;
  }

  getName(): string {
    return this._name;
  }

  getAge(): number {
    return this._age;
  }

  getBreed(): string {
    return this._breed;
  }

  setId(value: number) {
    this._id = value;
  }

  setName(value: string) {
    this._name = value;
  }

  setAge(value: number) {
    this._age = value;
  }

  setBreed(value: string) {
    this._breed = value;
  }
}
